<link href="<@sp.static/>/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="<@sp.static/>/assets/css/style.min.css" rel="stylesheet"/>
<link href="<@sp.static/>/assets/plugins/datatables/css/data-table.css" rel="stylesheet"/>
<div style="overflow: auto; height: 450px; position: relative; margin: 8px;">
    <div class="panel panel-inverse" data-sortable-id="form-stuff-5">
        <div class="panel-heading">
            <h4 class="panel-title">店铺查询</h4>
        </div>
        <div class="panel-body">
            <form id="activityForm" name="activityForm" method="post" class="form-inline">
                <input type="hidden" value="${activityType}" name="EQ_activityType"/>
                <input type="hidden" value="${activityIds}" name="selectActivityIds"/>

                <div class="col-md-4">
                    <label class="col-md-4" style="margin-top: 8px !important;">店铺名称：</label>
                    <input type="text" class="form-control" name="LIKE_name">
                </div>
                <div  class="col-md-4" >
                    <button type="button" class="btn btn-sm btn-success m-r-5" style="width: 130px;margin-right: 10px"
                            onclick="query()">查 询
                    </button>
                </div>
            </form>
        </div>
    </div>
    <div id="activityList"></div>
</div>
<button type="button" id="selectedButton" class="btn btn-sm btn-success m-5">选择</button>

<!-- jquery -->
<script src="<@sp.static/>/js/jquery/jquery-3.0.0.min.js" type="text/javascript" charset="UTF-8"></script>
<!-- jquery validate -->
<script src="<@sp.static/>/js/jquery/validation/jquery.validate.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="<@sp.static/>/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="<@sp.static/>/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="<@sp.static/>/js/layer/layer.js?v=1.6.8" type="text/javascript" charset="UTF-8"></script>
<script src="<@sp.static/>/js/custom/util.js?v=1.6.8" type="text/javascript" charset="UTF-8"></script>
<script src="<@sp.static/>/js/custom/message.js?v=1.6.8" type="text/javascript" charset="UTF-8"></script>
<script src="<@sp.static/>/js/custom/send.js?v=1.6.8" type="text/javascript" charset="UTF-8"></script>
<script language="JavaScript">
    $(function () {
        init();
        query();
    });

    function init() {
        $('#selectedButton').click(function () {
            parent.$('#storeNameDiv').empty();
            var stores = '';
            var storeNames = '';
            $("input:radio[name='id']:checked").each(function (index, elem) {
                //如果父页面已存在，则跳出执行下一条
                var storeName = $(elem).parent().parent().find("input[name='storeNameTD']").val();
                var storeId = $(elem).parent().parent().find("input[name='storeIdTD']").val();
                var showName = "<span class='label label-info f-s-14 m-t-5' style='display: inline-block;margin-right:5px;'>"+storeName+"</span>"
                parent.$('#storeNameDiv').append(showName);
                if (stores.length > 0) {
                    stores = stores + ',' + storeId;
                    storeNames=storeNames + ',' +storeName;
                } else {
                    stores = storeId;
                    storeNames=storeName;
                }
            });

            var store = '<input name="storeId" type="hidden" value="'+stores+'">';
            store=store+'<input name="storeName" type="hidden" value="'+storeNames+'">';
            parent.$('#storeNameDiv').append(store);

            parent.layer.closeAll();
        })
    }

    function query() {
        postDataByForm('${rc.contextPath}/backend/store/simple-quick-search-store', 'activityList', 'activityForm');
    }

    function checkOne() {
        var itemCheckBox = $("[name = 'id']:checkbox");
        $("#checkAll").prop("checked", itemCheckBox.length == itemCheckBox.filter(":checked").length);
    }

    function checkAll() {
        $("[name='id']").prop("checked",$("#checkAll").prop("checked"));
    }
</script>